import type { ComputedRef, Slots } from 'vue';
import type { AdListProps } from '../types/adList';
import { unref, computed } from 'vue';

export function useListHeader(propsRef: ComputedRef<AdListProps>, slots: Slots) {
  const getHeaderProps = computed((): Recordable => {
    const { title, titleHelpMessage, listSetting } = unref(propsRef);
    const hideHeader =
      !slots.headerTop && !slots.listTitle && !title && !slots.toolbar && !listSetting;

    return {
      hideHeader,
      title,
      titleHelpMessage,
      listSetting,
    };
  });
  return { getHeaderProps };
}
